﻿// i'd like add some comments here , what i referenced from jquery.com
//(function($){}(jqury)) is to keep "dollar sign" works


(function ($) {

    //----------- This is only a demo for jQuery plugin --------------//


    var methods={

        init: function () {
            return this.each(function () {
                $(this).hover(
                    function () {
                        $(this).addClass("hoverStyle");
                    }
                );
                $(this).mouseout(
                    function () {
                        $(this).removeClass("hoverStyle");
                    });
            });
        },

        maxMapHeight:function () {
            var max;
            return this.each(function () {
                max=Math.max(max,$(this).height());
            });
        },

        MapLoading:function () {
            function initialize() {
             var mp=new BMap.Map('map');
             mp.centerAndZoom(new BMap.Point(116.395645, 39.929986), 11);
            }
            var func_init=initialize();

            var script= document.createElement("script");
             script.src="http://api.map.baidu.com/api?v=1.4&callback=func_init";
             return document.body.appendChild(script);
        },

        BusNumSearch:function () {
            jQuery.getJSON('http://http://10.147.68.176:80/shuttleBusRoute.json', function(json) {
              alert(json );
            });
            
        }
  };


$.fn.shuttleBusMapTool=function (method) {
    if (methods[method]) {
        return methods[method].apply(this,Array.prototype.slice.call(arguments,1));

    }else if (typeof method==='object'|| method ) {
        return methods.init.apply(this,arguments);
    }else{
        $.error('Method'+method +'does not exist on jquery.shuttleBusMapTool');
    
}
};


  
})(jQuery); 








